<?php
	include("geoapi/geoipcity.inc");
	include("geoapi/geoipregionvars.php");
	include("json/json.php");
	if ($_SERVER["HTTP_X_FORWARDED_FOR"]=="")
	{
		$user_ip=$_SERVER["REMOTE_ADDR"];
	}
	else
		$user_ip=$_SERVER["HTTP_X_FORWARDED_FOR"];
	//echo $user_ip;
	$user_ip='12.0.48.0';
	$gi = geoip_open("GeoLiteCity.dat",GEOIP_STANDARD);
	$record = geoip_record_by_addr($gi,$user_ip);
	$custom_location=array('latitude'=>$record->latitude,'longitude'=>$record->longitude,'city'=>$record->city,'region'=>$GEOIP_REGION_NAME[$record->country_code][$record->region] );
	$json = new Services_JSON();
	$output=$json->encode($custom_location);
	echo $output;
?>
